$(function () {
    //var baseUrl = window.globalconfig.api;
    /**
     加载下达任务
     **/
    function getElect() {
        $.ajax({
            url: baseUrl + "getElect",
            // url: '../json/getElect.json',
            type: 'get',
            // dataType: 'default: Intelligent Guess (Other values: xml, json, script, or html)',
            data: {method: 'getElect'},
        })
            .done(function (data) {
                console.log("getElect");
                var data = data.data;
                var html = "";

                for (var i = 0; i < data.length; i++) {
                    html += `<div class="floatL mag_r25" style="background-color:silver">
            <table class="table1">
                <tr style="background-color:orange">
                    <th>工序</th>
                    <th>${data[i].processName}</th>
                </tr>
                <tr style="background-color:orange">
                    <th>设备编号</th>
                    <th>设备编号${data[i].deviceNum}</th>
                </tr>`;
                    if (data[i].andonStatus == 0) {
                        html += `<tr style="background-color:springgreen">
                    <th>设备状态</th>
                    <th class="fc_A">正常</th>
                </tr>`;
                    } else if (data[i].andonStatus == 1) {
                        html += `<tr style="background-color:red">
                    <th>设备状态</th>
                    <th class="fc_A">故障</th>
                </tr>`;
                    }
                    html += `<tr style="background-color:springgreen">
                    <th>生产批次号</th>
                    <th>${data[i].batch}</th>
                </tr>
                <tr style="background-color:#84ceff">
                    <th>生产总数</th>
                    <th>${data[i].productCount}</th>
                </tr>
                <tr style="background-color:#84ceff">
                    <th>生产不合格数</th>
                    <th>${data[i].productBadCount}</th>
                </tr>
            </table>
        </div>`;
                }
                // console.log(html)
                $(html).appendTo('#form_boxA');
            })
            .fail(function () {
                console.log("error");
            })
    }

    getElect();

})